import tkinter as tk
import tkinter.font as tf
from tkinter import ttk
import get_data as gd
import draw_picture as dp
import insert_third_window as itw




def insert_second_window(event):
    window2 = tk.Toplevel()
    window2.title("其他功能")
    window2.geometry("660x356")
    #window2.resizable(0,0)
 
    ft = tf.Font(family="华文仿宋",size=12)
    bb1 = tk.Button(window2,width=35,text = "查看疫情每日新增图", command = dp.draw_daily_add_line, font=ft)
    bb1.grid(row = 0,column = 0)

    bb2 = tk.Button(window2,width=35,text = "查看疫情当前确诊图", command = dp.draw_now_confirm_line, font = ft)
    bb2.grid(row=0,column = 1)

    bb3 = tk.Button(window2,width=35,text = "查看疫情累计确诊图", command = dp.draw_country_sum_line, font = ft)
    bb3.grid(row=1,column=0)

    bb4 = tk.Button(window2,width=35,text = "查看全国治愈死亡率图",command = dp.draw_rate_line, font = ft)
    bb4.grid(row=1,column = 1)

    bb5 = tk.Button(window2,width=35,text = "查看北京市确诊病例男女比例",command = dp.draw_pie_picture_one, font = ft)
    bb5.grid(row = 2,column = 0)

    bb6 = tk.Button(window2,width=35,text = "查看北京市确诊病例年龄比例",command = dp.draw_pie_picture_two, font = ft)
    bb6.grid(row = 2,column = 1)

    bb7 = tk.Button(window2,width=72,text = "查看石景山区是否开学建议",command = itw.insert_top_three_window, font = ft)
    bb7.grid(row = 4,column = 0,columnspan = 2)

  
    columns = ("row", "data", "time")
    tree = ttk.Treeview(window2, show = "headings", columns = columns, selectmode = tk.BROWSE)
    tree.column("row", anchor = "center",width = 10)
    tree.column("data", anchor = "center",width = 400)
    tree.column("time", anchor = "center",width = 100)
    tree.heading("row", text = "")
    tree.heading("data", text = "信息来源：北京市卫健委")
    tree.heading("time", text = "时间")

    lists = gd.get_news()
    lists1 = lists[0]
    lists2 = lists[1]
    i=0
    for list1 in lists1:
        tree.insert("",i,values = (str(i+1),list1,lists2[i]))
        i+=1
    tree.grid(row=3,column=0,columnspan = 2)


    window2.mainloop()
    